package com.md.application.assembler;


import com.md.domain.model.po.GlobalConfigPO;
import com.md.response.GlobalConfigResponse;
import com.md.value.GlobalConfigTypeEnum;
import lombok.experimental.UtilityClass;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @author 刘骄阳
 * @date 23/5/25 15:29
 **/
@UtilityClass
public class ConfigAssembler {
  public static List<GlobalConfigResponse> buildGlobalConfigPO2Response(final List<GlobalConfigPO> list) {
    return list.stream().map(globalConfigPO -> {
      GlobalConfigResponse response = new GlobalConfigResponse();
      response.setId(globalConfigPO.getId());
      response.setType(GlobalConfigTypeEnum.of(globalConfigPO.getType()));
      response.setValue(globalConfigPO.getValue());
      return response;
    }).collect(Collectors.toList());
  }
}
